#include<iostream>
#include<cmath>
using namespace std;
typedef long long LL;
const LL N = 2e7 + 10;
LL w[N], v[N];
LL ll[N], rr[N];
LL f[N],p[N];//前缀和
LL s, W;
LL n, m;
LL l, r;
LL ret, ss;
int main()
{
	cin >> n >> m >> s;
	for (LL i = 1;i <= n;i++)
	{
		cin >>w[i] >> v[i];
		r = max(r, w[i]);
	}
	for (LL i = 1;i <= m;i++)
	{
		cin >> ll[i] >> rr[i];
	}
	//二分
	//因为我们这个随着W的变化s是从负的，变到正的，我们的目标就是让他趋近0
	ret = 1e16;
	while (l < r)
	{
		LL mid = (l + r)>>1;
		//看看W这么大的时候y是多少
		for (LL i = 1;i <= n;i++)
		{
			if (w[i] > mid) f[i] = f[i - 1] + 1, p[i] = p[i - 1] + v[i];
			else f[i] = f[i - 1], p[i] = p[i - 1];
		}
		LL ans = 0;
		for (LL i = 1;i <= m;i++)
		{
			ans += (f[rr[i]] - f[ll[i]-1]) * (p[rr[i]] - p[ll[i] - 1]);
		}
		ss = s - ans;
		if (ss < 0) l = mid+1;
		else r = mid;
		ret = min(ret, abs(ss));
	}
	cout << ret << endl;
	
	return 0;
}